<ion-view view-title="{{product.properties.brand.value + product.properties.model.value}}" show-tabs>
  <ion-nav-buttons side="right">

    <button class="button" ng-class="{'button-icon ion-ios-compose-outline':!$root.isEdit,'button-clear':$root.isEdit}" ng-click="$root.toggleEdit();"><span ng-if="$root.isEdit">取消</span></button>
  </ion-nav-buttons>

  <ion-content>
    <ion-list class="wrap-light2">
    <form name="updateProductForm" ng-submit="$root.toggleEdit();update();">
      <ion-item class="item-base margin-bottom-large item-icon-right" ng-click="selectProduct();" ng-if="false">
        从商品库选择
        <i class="icon ion-fork-repo dark2"></i>
      </ion-item>

      <ion-item class="item-base item-select">
        <span class="list-label text-right">所属分类</span>
        <span>{{product.catalog}}</span>
        <select ng-model="product.catalog" ng-if="false">
          <option value="{{product.catalog}}" disabled="disabled">{{product.catalog}}</option>
        </select>
      </ion-item>

      <ion-item class="item-input item-button-right">
        <span class="list-label text-right">原厂条码</span>
        <input ng-model="product.barcode" type="text" ng-readonly="!$root.isEdit">
        <a class="button button-col icon icon-left ion-ios-barcode-outline" ng-click="scanBarcode()"> 扫码</a>
      </ion-item>
     <ion-item class="item-input" ng-if="false">
        <span class="list-label text-right">单品条码</span>
        <input ng-model="product.barcode" type="text" ng-readonly="!$root.isEdit">
        <a class="button button-col icon ion-ios-barcode-outline" ng-click="scanBarcode()"> 扫码</a>
      </ion-item>

      <ion-item class="item-divider margin-top-large">
        预设价格
      </ion-item>
      <ion-item class="item-input">
        <span class="list-label text-right">参考进价</span>
        <input ng-model="product.cost_price_default" type="text" ng-readonly="!$root.isEdit" auto-focus>
      </ion-item>
      <ion-item class="item-input">
        <span class="list-label text-right">销售价格</span>
        <input ng-model="product.sale_price" type="text" ng-readonly="!$root.isEdit">
      </ion-item>
      <ion-item class="item-input">
        <span class="list-label text-right">最低售价</span>
        <input ng-model="product.min_sale_price" type="text" ng-readonly="!$root.isEdit">
      </ion-item>

      <ion-item class="item-divider margin-top-large">
        商品属性
      </ion-item>

      <ion-item class="item-input" ng-repeat="property in product.properties">
        <span class="list-label text-right">{{property.name}}</span>
        <input ng-model="property.value" type="text" ng-readonly="!$root.isEdit" />
      </ion-item>

      <button class="button button-block button-balanced" type="submit" ng-if="$root.isEdit">保存</button>
      </form>
    </ion-list>
  </ion-content>
</ion-view>